Permanently Deleting Customer Records
When you delete a customer record, the record is marked in the database with a status of D. You must run the appropriate script for your database to permanently remove these customer records.
iMIS does the following when you run a script to permanently delete customer records marked with a status of D:
- A record is added to the Name_Log table. The record will have the following values: Date/Time,CHANGE,DELETE,GUEST,id,last_first,company
- The Activity table is updated. For every customer record that is deleted, all of that customer's activity records will have the ID set to ''.
- All references to deleted customers are removed from user-defined tables.
- All records for deleted customers are removed from the following tables:
- Name
- Name_Address
- Name_Fin
- Name_Note
- Name_Picture
- Name_Indexes
- Subscriptions
There are certain cases when the customer record will not be deleted:
- The customer has open orders. The script checks for the following field values in the Orders table:
ID = ID to be deleted and
STAGE <> "CLOSED" and STAGE <> "CANCELLED" and
STAGE <> "COMPLETED"
- The customer has an outstanding invoice balance. The script checks for the following field values in the Invoice table:
BT_ID = ID to be deleted and BALANCE <> 0
- The customer has active subscriptions. The script checks for the following field values in the Subscriptions table:
STATUS LIKE 'A%'
- The customer has an entry in the Referral module, and this customer owes money. The script checks for the following values in the Referral table:
PROVIDER_ID = ID to be deleted and
REFERRAL_FEE > 0 and READY_TO_INVOICE = 1 and ORDER_NUMBER = 0
- Deleting this customer will leave orphaned records. Examples of orphaned records include the following:
- Name record with a Bill_TO ID, where the Bill_To ID no longer exists.
- Name record with a Company_ID, where the Company_ID no longer exists.
- Name_Fin record, where the Bill_To ID no longer exists.
- Cert_Register records, where the Bill_To ID no longer exists.
For example, if ID 110 and 200 both have Cert_Register records with 110 as the Bill To Id, and ID is marked for deletion, and ID 200 isn't, ID 110 won't be deleted since that would leave ID 200 with a non-existent Bill To ID.